import Vue from 'vue'
import Vuex from 'vuex'


Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		baseURL: 'http://192.168.0.251:19150',
		userInfo: ''
	},
	mutations: {
		setUserInfo(state, val) {
			state.userInfo = val;
		},
		setBaseURL(state, url) {
			state.baseURL = url
		}
	},
	getters: {
		baseURL: state => state.baseURL,
		userInfo: state => state.userInfo, // 当前默认用户的信息
	},
	actions: {
		setUserInfo({
			commit
		}, val) {
			commit("setUserInfo", val);
		},
		setBaseURL({
			commit
		}, url) {
			commit("setBaseURL", url)
		}
	}
})

export default store